> use mongodbBulkUpdateExample;
// Output // 
switched to db mongodbBulkUpdateExample

> db.persons.insert([{_id:123, name:"JavaGeek", country:"USA"}, {_id:456, name:"PythonGeek", country:"USA"}, {_id:789, name:"SwiftGeek", country:"UK"}]);
// Output // 
BulkWriteResult({
        "writeErrors" : [ ],
        "writeConcernErrors" : [ ],
        "nInserted" : 3,
        "nUpserted" : 0,
        "nMatched" : 0,
        "nModified" : 0,
        "nRemoved" : 0,
        "upserted" : [ ]
})

> db.persons.find();
// Output // 
{ "_id" : 123, "name" : "JavaGeek", "country" : "USA" }
{ "_id" : 456, "name" : "PythonGeek", "country" : "USA" }
{ "_id" : 789, "name" : "SwiftGeek", "country" : "UK" }

> var bulk = db.persons.initializeUnorderedBulkOp();
> bulk.find( { country: "USA" } ).update({$set: {country: "India"}});
> bulk.execute();
// Output // 
BulkWriteResult({
        "writeErrors" : [ ],
        "writeConcernErrors" : [ ],
        "nInserted" : 0,
        "nUpserted" : 0,
        "nMatched" : 2,
        "nModified" : 2,
        "nRemoved" : 0,
        "upserted" : [ ]
})

> db.persons.find();
// Output // 
{ "_id" : 123, "name" : "JavaGeek", "country" : "India" }
{ "_id" : 456, "name" : "PythonGeek", "country" : "India" }
{ "_id" : 789, "name" : "SwiftGeek", "country" : "UK" }

> var bulkOne = db.persons.initializeUnorderedBulkOp();
> bulkOne.find( { country: "UK" } ).updateOne({$set: {country: "Russia"}});
> bulkOne.execute();
// Output // 
BulkWriteResult({
        "writeErrors" : [ ],
        "writeConcernErrors" : [ ],
        "nInserted" : 0,
        "nUpserted" : 0,
        "nMatched" : 1,
        "nModified" : 1,
        "nRemoved" : 0,
        "upserted" : [ ]
})

> db.persons.find();
// Output // 
{ "_id" : 123, "name" : "JavaGeek", "country" : "India" }
{ "_id" : 456, "name" : "PythonGeek", "country" : "India" }
{ "_id" : 789, "name" : "SwiftGeek", "country" : "Russia" }